﻿<UserControl x:Class="Big3.Hitbase.MainControls.ExtendedSearchUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Big3.Hitbase.MainControls"
             xmlns:sr="clr-namespace:Big3.Hitbase.SharedResources;assembly=Big3.Hitbase.SharedResources"
             mc:Ignorable="d" Name="extendedSearchUserControl"
             d:DesignHeight="100" d:DesignWidth="500">
    <UserControl.Resources>
        <local:ObjectToValueConverter x:Key="objectToValueConverter" />
        <local:ConditionVisibilityConverter x:Key="conditionVisibilityConverter" />
    </UserControl.Resources>
    <UserControl.CommandBindings>
    </UserControl.CommandBindings>
    <StackPanel Name="StackPanelCondition">
<!--        <Grid>
            <TextBlock Text="Erweiterte Suche:" VerticalAlignment="Center" />
            <Button HorizontalAlignment="Right" Command="local:ConditionCommands.SaveCondition">
                <StackPanel Orientation="Horizontal">
                    <Image Source="/Big3.Hitbase.SharedResources;component/Images/Save.png" Width="16" Height="16" Margin="0,0,3,0" />
                    <TextBlock Text="{sr:Loc Save}" />
                </StackPanel>
            </Button>
        </Grid>-->
        <ItemsControl Name="ItemsControlConditions">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="30" />
                            <ColumnDefinition Width="250" />
                            <ColumnDefinition Width="110" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="60" />
                        </Grid.ColumnDefinitions>
                        <Button Margin="5" Grid.Column="0" Name="ButtonDelete" Click="ButtonDelete_Click" ToolTip="{sr:Loc DeleteCondition}">
                            <Image Source="/Big3.Hitbase.SharedResources;component/Images/Delete12x12.png" Width="12" Height="12" />
                        </Button>
                        <ComboBox Margin="5" Grid.Column="1" Name="ComboBoxFields" ItemsSource="{Binding Path=AllFields, ElementName=extendedSearchUserControl}" DisplayMemberPath="DisplayName" SelectedValuePath="Field" SelectedValue="{Binding Field}" SelectionChanged="ComboBoxFields_SelectionChanged" >
                        </ComboBox>
                        <ComboBox Margin="5" Grid.Column="2" Name="ComboBoxOperator" ItemsSource="{Binding Path=AvailableOperators}" DisplayMemberPath="DisplayName" SelectedValuePath="Operator" SelectedValue="{Binding Operator}" SelectionChanged="ComboBoxOperator_SelectionChanged" ></ComboBox>
                        <TextBox Margin="5" Grid.Column="3" Name="TextBoxValue" TextChanged="TextBoxValue_TextChanged" Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}"  Visibility="{Binding Path=Operator, Converter={StaticResource conditionVisibilityConverter}}"></TextBox>
                        <ComboBox Margin="5" Grid.Column="4" Name="ComboBoxAndOr" ItemsSource="{Binding Path=AllLogicals, ElementName=extendedSearchUserControl}" DisplayMemberPath="DisplayName"  SelectionChanged="ComboBoxAndOr_SelectionChanged"></ComboBox>
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
<!--        <Button HorizontalAlignment="Left" Command="local:ConditionCommands.ExecuteSearch">
            <StackPanel Orientation="Horizontal">
                <Image Source="/Big3.Hitbase.SharedResources;component/Images/Search.png" Width="16" Height="16" Margin="0,0,3,0" />
                <TextBlock Text="{sr:Loc ExecuteSearch}" />
            </StackPanel>
        </Button>-->
    </StackPanel>
    <UserControl.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="White" Offset="0" />
            <GradientStop Color="#FFF7BE57" Offset="1" />
        </LinearGradientBrush>
    </UserControl.Background>
</UserControl>
